Diskman is a suite of advanced programs designed to perform a variety of low level hard disk releated tasks not normally possible. Diskman is free for non-commerical use. Full script language, backup and restore Long File Names (LFN), archive compatible with DOSLFNBK, delete, create and manipulate disk partitions, quickly format FAT volumes, securely erase either volumes or entire drives, mount and manipulate disk images (such as those created for Rawrite), export volumes or entire physical drives for later restore, quickly copy every file into image files for easy backup and later restore, browse FAT volumes quickly and easily, directly edit disks at the sector level, support for all BIOS supported disks, DOS supported drives and Image files, help repair disks after a virus attack or rescue critical data, backup and restore CMOS memory images, including latest 256 byte chipsets.
 
Search Diskman Forum
 Diskman> Diskman 4 ManualMonday 29th November 2004 

Diskman 4 Manual

See also

Diskman 4 News

Diskman 4 Command Reference

Diskman 4 Examples

Introduction

Welcome to the Diskman 4 manual!

Diskman is an advanced disk manipulation tool designed to offer a complete solution to those wishing to copy, clone, backup or destroy disks and partitions quickly. Diskman allows many actions that were previously difficult or even impossible to be completed quickly and with a high degree of safety. Diskman includes a powerful command system and script ability that allows an almost limitless number of operations to be performed. If you can think of a task Diskman can probably perform it. Diskman is free for noncommercial use and includes a discussion forum for asking Diskman questions.

Diskman has taken almost three years to evolve to its current state and hopefully Diskman 4 will become the de-facto edition. The latest version features a number of big changes in the way that DM works which follow a large number of suggestions that have been submitted through the website. Diskman 4 is the first version of DM to be publicity 'alpha' tested. This change is designed to ensure that the software is as stable as possible when publicity released.

This manual is targeted at both Diskman novices and those who have experience with previous versions. Diskman is a powerful tool but requires a relatively high degree of technical knowledge to use proficiently and can be used dangerously by inexperienced users. This manual hopefully will explain things logically but I do not make any apologies for not giving a lesson in disk fundamentals. You should not use Diskman unless you are familiar with terms such as FDISK, FORMAT, Partition and FAT32. Users of Diskman should also be familiar with Hexadecimal number notation and the conversion from Hexadecimal to Decimal.

Extensive work has been undertaken in Diskman 4 to reduce the complexity of the available commands, link commands together logical groups and remove unnecessary duplication. If you spot an opportunity to remove a duplicate command or combine two similar commands please let me know.

I am extremely grateful to all those people who have contributed along the way. I will continue to develop Diskman and license it free for noncommercial use as long as the support, bug reports and suggestions keep flowing. Thank you.

Diskman 4 Changes

Diskman 4 features many changes from previous versions.

The most important improvement is that the commands have been reorganized into more logical groups. This much requested change unfortunately breaks command compatibility with previous DM versions. However, hopefully the new structure will help in locating the command for a particular operation and making things much clearing. Several important new features have been added (direct copy of one volume to another, full script support and improved sector import/export abilities) and a few less popular commands removed (MSCDEX compatible drives and the menu system).

A second big change from previous versions (especially version 2) is that there is now a clearer division between the two key Diskman concepts of 'Drives' and 'Volumes'. In previous versions a complex set of 'Volume Codes' was required for any operation. This has been replaced with the simple 'Volume ID' concept that functions in exactly the same way as 'Drives'. There is also no longer any concept of the 'current drive', all commands must now explicitly reference either a volume or drive number. This keeps scripts much simpler.

Diskman 4 has been through an extensive period of testing with a force of volunteer testers. This has helped removed many simple bugs and also allowed the command structure to be made as effective as possible.

Lastly, unlike previous versions of Diskman the first hard disk is no longer automatically mounted at startup. This feature adds an additional overhead when DM is run from the basic command line but is extremely useful when DM is run from a script as all drives must be explicitly mounted. To achieve similar behavior to previous versions (1.xx, 2.0, 2.1 and 3.0) the first command issued should be DRIVE MOUNT BIOS 0x80.

Hexadecimal Numbering

For historical and practical reasons most of the examples in this tutorial use hexadecimal numbering notation. The Windows Calculator application can be used to convert between hexadecimal and decimal notation. Hexadecimal numbers are base-16 and use the letters A,B,C,D,E,F in addition to the more usual 0-9. In printed material hexadecimal numbers are usually represented with a leading '0x'. The following simple conversion chart may be useful:

Hex Decimal
0x11
......
0xA10
......
0x1016
......
0x81129

The Diskman website includes a Javascript based calculator. This can be used for hexadecimal conversions.

Command organization and help

Diskman 4 incorporates a comprehensive inbuilt help system. Commands are grouped into logical families and a description of each command may be found by using the HELP command. For instance:

HELP VOLUME

- Lists command help for the VOLUME command A full list of currently supported commands can be found by using the HELP command without any second parameter. Additionally the HINT command can be used to locate a particular command. For instance, to list all commands starting with BOOT use HINT BOOT.

Drive Concept

In Diskman a 'drive' is a raw physical disk.

A 'drive' can take many forms including a hard drive, a floppy disk drive, or an image file simulating a physical drive. Most PC's have one floppy drive and one or more hard drives. Diskman provides several ways to access a physical drive. Drives can be controlled with the DRIVE command. Unlike previous versions DM4 does not auto-mount the first hard disk on startup, therefore each Diskman session starts as a blank canvas. Additionally drives can be mounted as 'read-only' to protect their contents from change;this automatically happens if a image file is mounted on read-only media (a CD-ROM for instance).

Diskman allows additional drives to be 'mounted' or added to the list of available drives. Additionally, Diskman 4 (unlike previous versions) allows drives to be 'unmounted' or removed from the list of available drives. Crucially, Diskman 4 functions perfectly with no drives 'mounted' although the number of operations possible will be limited. Importantly, Diskman 4 allows the same physical drive to be mounted multiple times. In some circumstances this feature can prove extremely useful. Drives are numbered sequentially starting at 1. Unlike previous Diskman versions the release version of DM4 does not support a 'current drive'. This concept often confused users and has therefore been removed. A list of the currently available drives can be found with the DRIVE LIST command.

Drives should not be confused with 'volumes'...

Volume Concept

A 'Volume' is analogous to a DOS or Windows 'drive letter'. For instance, in MS-DOS 'C:' usually represents the system volume.

In Diskman a 'drive' will contain zero or more 'volumes'. A 'volume' is either raw or contains a regconised File System (such as FAT or NTFS). Volumes are automatically detected when the corresponding host drive is mounted. Some host drive types support multiple volumes (these are said to be partitioned) whilst other (floppy disks for instance) contain only a single volume. Volumes can be managed using the VOLUME family of commands.

A list of the currently available volumes can be found using the VOLUME LIST command.

Unlike previous versions of Diskman volumes are abstract from physical partitions and are simply allocated a numerical volume ID. Volumes are numbered sequentially starting at 1. This ID should remain constant whilst the host drive remains mounted although this may not be true in a few rare cases (the circumstances in which a VolID can change are explained in the command reference). Volumes are automatically removed when the corresponding host drive is dismounted.

Most Diskman commands act upon a specified volume or volumes. Unlike previous versions there is no longer any concept of a current or active volume.

Partitions

Previous versions of Diskman relied heavily upon the physical layout of partitions on a drive. This confused users and limited the number of complex operations that were possible. The new use of simple VolumeIDs has greatly simplified this and therefore there are only a few cases where knowledge at this level is required. A few partition manipulation commands are grouped under the PART family but these will hopefully be reduced in the future.

The standard MBR partition table can contain a maximum of 4 partitions. These are numbered 1-4.

The partition table for the currently active drive can be obtained with the PART LIST command.

Different Drive types

As mentioned previously Diskman supports a number of physical drive types. These can be broadly summarized as follows:

Drive Type Details
DOS

DOS drives are provided for convenience and map directly to DOS drive letters. DOS drives can only ever contain one volume. The ability to access a DOS drive often avoid lots of tedious manipulation trying to locate a particular logical drive. In general if a DOS drive letter is known for the volume required then use it.

DRIVE MOUNT DOS A:

DRIVE MOUNT DOS E:

DOS drives are mounted as 'read-only' when running in a Windows 9x DOS box. Unlike previous versions Diskman 4 does not currently support the mounting of CD/ROM or network drives. DM4 does not allow DOS drives to be mounted when running in a Windows NT/2000/XP DOS box. This behavior is by design. A full list of the DOS drives currently available can be obtained with the DRIVE LIST DOS command.

RAWP

A RAWP image file functions in the same manner as a RAW image except that it is assumed to contain a partitioned drive. This can be useful for simulated physical hard disks (that are also partitioned). A RAWP image can simulate a drive upto 2GB.

DRIVE MOUNT RAWP C:\DRIVE.BIN - mount the file C:\DRIVE.BIN as a 'partitionable' drive

Images mounted as RAWP can be partitioned and manipulated in exactly the same way as physical drives. RAWP images provide a simple way to store every structure required to rebuild a hard disk based file system (a MBR, a boot record and files).

Volume types (Filesystems)

Volumes are recognized as one of the following:

Filesystem Notes
FAT12< 16MB. Most common on floppy disks
FAT32>100MB

The FAT filesystem is the most widely support filesystem currently available and is supported by MS-DOS (and its clones), MS Windows and Linux. Diskman fully supports all of the FAT formatted volumes and offers a limited ability with 'unknown' and NTFS volumes. Additional support for NTFS is currently being developed although this is unlikely to become very usable until Diskman 5.

Variables and the DOS environment

Diskman supports an integrated environment space that is independent of that provided by DOS. In otherwords, variables can be assigned values and these can be used throughout the Diskman command hierarchy.

SET TEST 10 - Define a variable called 'TEST' and associate it with the value 10

A variable may be used in any other command by applying the $ prefix. For instance the following mini-script is prefectly valid:

SET SOURCEPART 3 PART TYPE SET $SOURCEPART 7

A number of built in variables are defined for use when issuing commands or creating Diskman scripts:

$RESULT - Always contains the numerical result of the last executed command

$FAT16 - Used to specify FAT16 etc.

$MAX - Wherever the maximum possible value should be used

$TRUE - To indicate that something is TRUE (or YES)

$FALSE - To indicate that something is FALSE (or NO)

A list of the currently defined variables may be obtained by issuing the command SET. The DOS environment space can be loaded into Diskman by using the SET DOS command. This may be useful if the DOS environment contains a variable (for instance %PATH) that is required in a script.

Diskman 4 now supports the variables within command elements (just like DOS batch files). For instance the following is valid:

SET FILENAME IMAGE DRIVE MOUNT RAW C:\$FILENAME$.BIN

*Note that currently only one $name$ construct can be used within each command element. Command elements are separated by spaces. Therefore DRIVE MOUNT C:\$FILENAME$.BIN contains 3 command elements. This may be improved in a future revision.

Lastly, Diskman 4 now allows variables to be defined directly as the result of a previous command. For instance the DRIVE MOUNT command returns ID of the newly mounted drive. This can always be obtained later with the $RESULT variable but instead the DEF command may be used to define (or redefine) a variable immediately. For instance:

DEF SOURCE DRIVE MOUNT RAW C:\IMAGE.BIN
PRINT The image was mounted as drive $SOURCE

Command line

Just like previous versions Diskman 4 supports commands being issued directly from the DOS command line. Multiple commands may be separated by semicolons (;).

For instance a compound statement can be issued to wipe the second hard disk:

DISKMAN DEF DRV DRIVE MOUNT BIOS 0x81;DRIVE WIPE ALL $DRV

The full range of commands is supported directly from the DOS command line. However, it must be remember that if Diskman is called repeatedly (from successive DOS commands or from within a batch file) the Diskman environment is restarted on each call. Therefore any variables that have been defined or drives that have been mounted will be forgotten between successive instances of Diskman.

Console Sessions

Similarly, Diskman 4 provides a full command console. This avoids invoking Diskman multiple times and means that any environment (mount drives etc.) is maintained between successive calls. A Diskman console session can be started with the simple CONSOLE command. At the console commands can be directly entered (without using the DISKMAN program name as at the DOS command line).

Diskman 4 also supports nested Console sessions. The CONSOLE command can be issued from within an existing console session. It is important to realise that in the current release the Diskman environment is global and therefore any variables etc. that have been defined can potentially be modified by any console session.

 DISKMAN4 Console
-------------------------------------------------------------------------------
DISKMAN4 Revision 4.01 (c) James Clark 1999-2002 [Build 09:46:07 May 06 2002]
DOSLFNBK file compatibility courtesy of Duncan Murdoch - dmurdoch@pair.com
Licensed to : Beta testing. Use free for noncommercial projects
This software may not be copied, distributed, modified, or incorporated within
any product or service without the written permission of the copyright holder
This software may be used freely for noncommercial purposes. Please contact
licensing@diskman.co.uk for commercial terms. Most commercial licenses restrict
the use of this program to a single machine/user. Unless the license states
otherwise only one copy of this software may be used at any instance without
the purchase of additional licenses. This software is supplied `as is' and the
author accepts no liability for damage this program causes through either
unexpected operation or intended misuse. This program may only be used if you
consent to the above conditions. Visit www.diskman.co.uk for more information
Type HELP for command information
DISKMAN4>

Diskman Explorer

Diskman 4 includes the same basic drive viewer as previous editions. The menu system found in Diskman 2.1 has not been implemented in the current release as is has been decided that the emphasis should firmly be on performing actions using the commands provided.

To start the Explorer use the DRIVE EXPLORE command.

In 'Explore' mode DM displays a hexadecimal dump of a disk sector. At the bottom of the screen a list is given of the volumes present on the drive.

Click on the image to enlarge

To change the currently active drive press X. DM will display a list of drives. Select the desired drive with the arrow keys and press Enter.

Bug: DM 4 does not correctly support the disk change line on some floppy drives - this can sometimes causes errors when accessing a floppy disk that was changed after DM was started. This bug will be fixed in a future revision.

Navigating the disk by sector

To move to a specific sector either:

  • Use the Left/Right arrow keys to move through the disk
  • Select 'L' and enter the absolute sector required (relative to the start of the drive)
  • Select 'O' and enter the offset of the sector required (relative to the current sector)

Selecting the current volume

In Explore mode Diskman always displays a list of the available volumes ('drives' under DOS) on the currently active drive. The volume list is exactly the same as that provided by the VOLUME LIST command in CONSOLE mode. To move to a particular volume press the key which corresponds to the Volume ID (0-9).

Displaying volume information

A FAT volume is defined by a number of properties which are listed in the boot record. Diskman only requires a subset of this information to accurately describe a volume. To display the volume information for the currently active volume press V. Similarly a more detailed report of the boot record can be obtained by located the bootrecord sector (always with offset 0 within a volume) and pressing B.

Property Description
VdriveThe virtual drive number where the volume is located
Volume OffsetThe absolute sector number where the volume starts
Num FATSThe number of File Allocation Tables in the volume
FAT SectorsThe size of one FAT table in sectors
Cluster OffsetThe first sector of cluster #2 (the first data cluster) relative to the start of the volume
FAT16 Root Entries
FAT16 Root Sectors
FAT16 Root Offset
These fields describe the location and size of the root directory when the volume is FAT12 or FAT16. A FAT32 volume does not have these fields but instead will report the start cluster of the root directory.
Slack SpaceThe slack space records the number of wasted sectors at the end of the volume. This number is usually <Cluster Size for a well behaved volume. This field must be >=0 for a volume to be viable.
Approx. MAX volume sizeThis field reports the possible size of the volume if a hybrid FAT is in use. This will normally be similar to the Volume Size field
Dirty FlagThis field indicates that Diskman has changed the contents of the volume.

Changing Clusters

To move to a specific cluster press the C key and enter the required cluster. Clusters are numbered 2 upwards. Diskman uses the convention that cluster 0 is the root directory. On a FAT32 volume selecting cluster 0 will actually jump to the real cluster used for the directory.

Displaying the root directory

To display the root directory change to cluster 0 (see above) and press D. Similarly a give directory can be displayed by navigating to that directory and pressing D. To quickly locate a directory determine its cluster number (listed in the directory view) and press C to change cluster followed by D.

Following the partition chain

To follow a partition table chain locate the starting table (the master table is always at sector 0) and press P.

Script language

Diskman 2.1 introduced a simple script environment but this was very unstable and often performed strange behavior. Diskman 4 incorporates a completely rewritten script system (all commands are now executed as internal scripts) which is both stable and powerful. Scripts are loaded into memory when executed and therefore unlike DOS batch files the media containing a script may be removed without the script crashing. Scripts may be any size and are only limited by the amount of conventional memory fitted (practically scripts of 100KB+ should be now problem).

Scripts allow multiple commands to be executed in sequence and thus very powerful manipulations can be performed. Diskman 4 incorporates the ability to conditionally execute a command or jump location with an existing script. Finally, scripts can incorporate comments using either the REM or # commands.

As an example the following script will duplicate a floppy disk image 5 times:

#Create five floppy disks from a master image
CLS
#Set the counter to an
initial value of 1
SET COUNT 1
#Loop to here on each iteration
:LOOP
#Ask the user to insert the disk and then mount
#the source and destination
PRINT Insert disk $COUNT and press any key
DEF DEST DRIVE MOUNT BIOS 0x0
DEF SRC DRIVE MOUNT RAW C:\FLOPPY.BIN
#Perform the actual copy operation
DRIVE COPY RAW $SRC 0 $MAX $DEST
#Unmount the source and destination drives
DRIVE UNMOUNT $SRC
DRIVE UNMOUNT $DEST
PRINT Disk $COUNT finished
#Increment the counter and repeat if required
INC $COUNT
IF $COUNT LESSTHAN 6 GOTO LOOP
:END
PRINT The disk duplication is complete

Lastly, it is important to realise that in the current release the Diskman environment is global and therefore any variables etc that have been defined can potentially be modified by any script called from within another script..

Preparations

A common requirement when using Diskman is to have available a set of common boot records for the operating systems that are to be manipulated. These can be obtained piecemeal as an when required but a sensible Diskman user should attempt to build up a library of the following. These will prove extremely useful overtime. Regrettably these cannot be supplied with Diskman for copyright reasons but it is perfectly legal to backup and retain the following providing that your are correctly licensed for each Operating System product.

File Required Suggested Filename Method/Notes
Windows 95 FAT16W95BOOT.F16Use the BOOTRECORD SAVE command as illustrated in the example below.
Windows 98 FAT16W98BOOT.F16The Windows 98 boot record (both FAT16 and FAT32) appears capable of booting all Windows 9x/Me generation systems.
Windows Me FAT16WMEBOOT.F16As above
Windows NT4 FAT16WMEBOOT.F16Use the BOOTRECORD SAVE command as illustrated in the example below.
Windows 2000 FAT32W2KBOOT.F32As above
Windows XP FAT32WXPBOOT.F32As above.

For example the following commands can be used to obtain the standard MBR that is shipped with Microsoft Windows 98 from the first hard disk:

DEF DRV DRIVE MOUNT BIOS 0x80
MBR SAVE $DRV A:\STDMBR.BIN

Similarly the following commands can be used to obtain the FAT32 boot record from a standard installation of Microsoft Windows 2000:

DEF DRV DRIVE MOUNT DOS C:
DEF SRC VOLUME FIND FIRST $DRV
BOOTRECORD SAVE $DRV A:\W2KBOOT.F32

Images files

Diskman supports the manipulation of image files and this can often be a very powerful tool. There are many versions of the RAWREAD/WRITE program available for download on the Internet (Diskman features at least two methods for doing this) and it may be desirable to poke around inside a previously created 'rawwrite' image file. In DM this can be performed in a number of ways, the simplest, would probably be the following:

1. Start a DM console session with the CONSOLE command.

2. Select any drive (lets use a floppy in A: as a safe option). DEF DRV DRIVE MOUNT BIOS 0

3. Export the entire drive DRIVE EXPORT RAW $DRV 0 C:\IMAGE.BIN

4. To later remount the image file use the DRIVE MOUNT RAW command.

5. To create a blank image file use the DOS CREATE command.

This command will not be requited in release 3.0

Diskman System Variables

Diskman includes a number of system variables that may be used to access commonly required information. The complete list of system variables may be displayed using the SET command. The currently defined variables include the following:

Variable Description
$TRUEIs always true
$FAT12Represents FAT12, as used on floppy disks and small partitions
$FAT32Represents FAT32, as used on drives >100MB
$MAXThis represents the largest possible value

Technical Information

Diskman has the following technical specification. Various versions of DM may not feature the entire list of features.

Diskman has been successfully tested under the following operating systems:

  • DOS 3.2 upwards or Microsoft Windows 95/98 (either MS-DOS mode or DOS box)
  • Windows NT4/2000/XP (does not currently support hard disk access)
  • Linux/DOSEMU (emulated drive images)
  • FreeDOS

Diskman supports the following drive types

  • All standard floppy disk sizes
  • BIOS supported Hard Disk Drives <2TB
  • Supports Int13 BIOS extensions for >8GB drive access
  • Standard 'raw' image files
  • All DOS supported 'drives', including RAM drives

Diskman supports the following disk formats

  • Supported file systems FAT12, FAT16, FAT32 (and FAT32x)
  • NTFS and Ext2FS (browse at sector level only, no recovery or directory browse)
  • Supported disk access method BIOS CHS/LBA access
  • Drive/volume image file access (such as images created for RawWrite)

Disk navigation functions

  • Full navigation and editing of drive at sector and cluster levels
  • Full display of FAT tables, ability to follow fat chain and check FAT integrity
  • Full display of Directory Entries and built-in Long File Name (LFN) support
  • Full display and editing of partition tables
  • Full support for nested extended partitions

Partition Table functions

  • Create partition (currently not extended partitions)
  • Create multiple Primary partitions (not supported by some DOS versions)
  • Delete partition/delete all partitions
  • Change partition type
  • Change bootable (active) partition
  • Locate partition by type
  • Save/Load partition table records
  • Hide/Unhide partitions
  • Logically reorder partition table to reflect disk layout (important for Windows NT)

Boot record functions

  • Save/Load/Merge boot record of given partition (convert Windows 95/98 to NT4/2000)
  • Wipe Master Boot Record (MBR)
  • Save/Load/Merge MBR

Bug Reporting

Contact the Author

Diskman is developed by James Clark, an electronics engineer, working for a leading UK computer manufacturer. If you are interested in the Diskman project, have any comments/suggestions or want to report a bug please contact me or use the Diskman forum.

DISKMAN History

Diskman development has taken over 12 months and has moved through the following stages


Version 2.00 (Released February 2000)

Completely rewritten to support LBA disk access(>8GB hard disks), LFN backup/restore, FAT32 boot sector save/load/merge, multiple drives. First version to understand FAT volume structure to access directory records and FAT table entries. Floppy drive support added (but no support for FAT12 file system).

Version 3.0 (Developed October 2000-Feburay 2001)

Finished version of the features tested in revision 2.1. This version improves upon the features of the previous version with enhanced stability and an improve command interface. This version reintroduces long filename backup/restore and is archive compatible with DOSLFNBK. Diskman 3 was designed to be an interim release while DM4 was under development.

Diskman 4 Manual Revision 0.2 5th May 2002

 
  Diskman ©1999-2004. All Rights Reserved, A Bespoke Site